/**************************************************************
*
* M3D_TRF.H
*
* TRF Coordinate systems (CS) operations
**************************************************************/

class m3dTRF {
public:
   m3dTRF(void): tran(m3dVZero), rot() {}

   void  Identity        (void);

   void   ApplyTo   (m3dMATR *m) const;
   void   GetMatr   (m3dMATR *m) const
   {
      rot.GetMatr(m);
      m->Translate(&tran, M3D_POST);
   }

   void SetMatr (const m3dMATR *m)
   {
      rot.SetMatr(m);
      m->GetOrigin(&tran);
   }

   void SetDif (const m3dTRF* from, const m3dTRF* to)
   {
      m3dQUAT qFromInv;
      from->rot.Invert(&qFromInv);

      m3dMultiplyQuat(&to->rot, &qFromInv, &rot);

      // get translate
      m3dSubtractVector(&to->tran, &from->tran, &tran);
   }

public:
   m3dV    tran;
   m3dQUAT rot;
};


extern void m3dMultiplyTrf  (const m3dTRF *a, const m3dTRF *b, m3dTRF *c);

//
// End of file 'M3D_TRF.H'
//
